<?php

/**
 * 一级导航Action
 * @note  实现了对了一级导航的管理
 * @class  YJDHAction
 * @file  YJDHAction.php
 * @author 赤菁风铃
 * @time  2014年04月14日 16:35:39
 */



/**
 * Class YJDHAction 一级导航Action
 */
class YJDHAction extends DefaultAction
{
       
    #region 一级导航管理功能
    
    #region 管理首页
    /**
     * 默认进入的管理列表页面
     */
    public function YJDH_Index()
    {
    
        #region 初始化页面参数
        $pageSize =array_key_exists("PageSize",$_GET) ? $_GET["PageSize"] : 20; //分页大小
        $pageIndex = array_key_exists("PageIndex",$_GET) ? $_GET["PageIndex"] : 1; //当前页
        $orderby=""; //默认排序方式可以留空，如需修改需要参照　"order by YHXX.YHXX_BH "格式
        $sql= ""; //如无特殊要求，不要扩展该属性
        
        $params =  array();
        $params['MHCX'] = $_GET['MHCX'];
        $params['YJDH_LX'] = $_GET['YJDH_LX'];
        $params['YJDH_TZFS'] = $_GET['YJDH_TZFS'];
        #endregion 初始化页面参数
        
        //保存相关参数
        $this->assign("params", $params);
        $this->assign("Model", YJDH::query($params, $pageSize,$pageIndex,$orderby,$sql));
        //显示view
        $this->display('YJDH_Index');
    }
    #endregion 管理首页
    
    #region 数据添加页面
    /**
     * 数据增加初始页面
     */
    public function YJDH_Insert()
    {
         $yjdh = new YJDH($_POST);
         $this->assign("Model", $yjdh);
         $this->display('YJDH_Insert');
    }

    /**
     * 数据增加处理页面
     */
    public function YJDH_Insert_Action()
    {
        $yjdh_bh_ora = security_decrypt($_POST["YJDH_BH_ORA"]);
        if ($yjdh_bh_ora == null) {
            $this->ajaxReturn(array("success" => false, "message" => "您传入的参数非法！"));
            return;
        }
        $result = ""; //数据插入的结果
        $yjdh = new YJDH($_POST);
        $yjdh_insert = new YJDH();
        $yjdh_insert->YJDH_BH = $yjdh_bh_ora;
        
        //如果需要限制用户插入的信息，可选择性修改下方内容
        $yjdh_insert->YJDH_MC = $yjdh->YJDH_MC; //一级导航_名称
        $yjdh_insert->YJDH_LX = $yjdh->YJDH_LX; //一级导航_类型
        $yjdh_insert->YJDH_TZFS = $yjdh->YJDH_TZFS; //一级导航_跳转方式
        $yjdh_insert->YJDH_CLJ = $yjdh->YJDH_CLJ; //一级导航_超链接
        $yjdh_insert->YJDH_XSSX = $yjdh->YJDH_XSSX; //一级导航_显示顺序
		$result .= $yjdh_insert->insert();
        $this->ajaxReturn(array("success" => empty($result), "message" => $result));
    }
    #endregion 数据添加页面
    
    #region 删除数据处理
    /**
     * 根据主键删除单一对象
     */
    public function YJDH_Delete()
    {
        //参数检查
        $yjdh_bh=$_GET['YJDH_BH'];
        if (!empty($yjdh_bh)) {
            $yjdh_bh = security_decrypt($yjdh_bh);
            if ($yjdh_bh == null) {
                $this->ajaxReturn(array("success" => false, "message" => "您传入的参数非法！"));
                return;
            }
        }
        
        //删除数据
        $yjdh = new YJDH();
        $result = $yjdh->delete($yjdh_bh);
        $this->ajaxReturn(array("success" => empty($result), "message" => $result));
    }
    #endregion 删除数据处理
    
    #region 数据修改页面
    /**
     * 数据修改首页面
     */
    public function YJDH_Update()
    {
        //传入参数检查
        $yjdh_bh=$_GET['YJDH_BH'];
        if (!empty($yjdh_bh)) {
            $yjdh_bh = security_decrypt($yjdh_bh);
            if ($yjdh_bh == null) {
                $this->ajaxReturn(array("success" => false, "message" => "您传入的参数非法！"));
                return;
            }
        }
        
        //数据验证
        $yjdh = new YJDH();
        $result = $yjdh->fetch($yjdh_bh);
        if (!empty($result)) {
            $this->ajaxReturn(array("success" => false, "message" => "您要修改的数据已被他人删除！"));
            return;
        }        
        
        //进入数据修改页面
        $this->assign("Model",$yjdh );
        $this->display('YJDH_Update');
    }

    /**
     * 数据修改处理页面
     */
    public function YJDH_Update_Action()
    {
        //数据验证
        $yjdh_bh_ora = security_decrypt($_POST["YJDH_BH_ORA"]);
        if ($yjdh_bh_ora == null) {
            $this->ajaxReturn(array("success" => false, "message" => "您传入的参数非法！"));
            return;
        }
        
        $yjdh = new YJDH($_POST);
       
        //检查数据是否存在
        $yjdh_update = new YJDH();
        $result = $yjdh_update->fetch($yjdh_bh_ora);
        if (!empty($result)) {
            $this->ajaxReturn(array("success" => false, "message" => "您要修改的数据已被他人删除！"));
            return;
        }        
        
        //如果需要限制用户插入的信息，可选择性修改下方内容
        $yjdh_update->YJDH_MC = $yjdh->YJDH_MC; //一级导航_名称
        $yjdh_update->YJDH_LX = $yjdh->YJDH_LX; //一级导航_类型
        $yjdh_update->YJDH_TZFS = $yjdh->YJDH_TZFS; //一级导航_跳转方式
        $yjdh_update->YJDH_CLJ = $yjdh->YJDH_CLJ; //一级导航_超链接
        $yjdh_update->YJDH_XSSX = $yjdh->YJDH_XSSX; //一级导航_显示顺序
		$result .= $yjdh_update->update($yjdh_bh_ora);
        $this->ajaxReturn(array("success" => empty($result), "message" => $result));
    }
    #endregion 数据修改页面
    
    #region 数据查询
    /**
     * 默认进入的数据查询页面
     */
    public function YJDH_Query()
    {
        #region 初始化页面参数
        $pageSize =array_key_exists("PageSize",$_POST) ? $_POST["PageSize"] : 20; //分页大小
        $pageIndex = array_key_exists("PageIndex",$_POST) ? $_POST["PageIndex"] : 1; //当前页
        $orderby=""; //默认排序方式可以留空，如需修改需要参照　"order by YHXX.YHXX_BH "格式
        $sql= ""; //如无特殊要求，不要扩展该属性
        
        $params =  array();
        $params['MHCX'] = $_POST['MHCX'];
        $params['YJDH_LX'] = $_POST['YJDH_LX'];
        $params['YJDH_TZFS'] = $_POST['YJDH_TZFS'];
        #endregion 初始化页面参数
            
        //保存相关参数
        $this->assign("params", $params);
        $this->assign("Model", YJDH::query($params, $pageSize,$pageIndex,$orderby,$sql));
        //显示view
        $this->display('YJDH_Query');
    }
    #endregion 数据查询
    
    #endregion 一级导航管理功能

    #region 二级导航管理功能

    #region 管理首页
    /**
     * 默认进入的管理列表页面
     */
    public function EJDH_Index()
    {

        #region 初始化页面参数
        $pageSize =array_key_exists("PageSize",$_GET) ? $_GET["PageSize"] : 20; //分页大小
        $pageIndex = array_key_exists("PageIndex",$_GET) ? $_GET["PageIndex"] : 1; //当前页
        $orderby=""; //默认排序方式可以留空，如需修改需要参照　"order by YHXX.YHXX_BH "格式
        $sql= ""; //如无特殊要求，不要扩展该属性

        $params =  array();
        $params['MHCX'] = $_GET['MHCX'];
        $params['YJDH_BH'] = $_GET['YJDH_BH'];
        $params['EJDH_TZFS'] = $_GET['EJDH_TZFS'];
        #endregion 初始化页面参数

        //处理加密后的外键
        if (!empty($params["YJDH_BH"])) {
            $params["YJDH_BH"] = security_decrypt($params["YJDH_BH"]);
            if ($params["YJDH_BH"] == null) {
                $this->ajaxReturn(array("success" => false, "message" => "您传入的参数非法！"));
                return;
            }
        }

        //保存相关参数
        $this->assign("params", $params);
        $this->assign("Model", EJDH::query($params, $pageSize,$pageIndex,$orderby,$sql));
        //显示view
        $this->display('EJDH_Index');
    }
    #endregion 管理首页

    #region 数据添加页面
    /**
     * 数据增加初始页面
     */
    public function EJDH_Insert()
    {
        $ejdh = new EJDH($_POST);
        $this->assign("Model", $ejdh);
        $this->display('EJDH_Insert');
    }

    /**
     * 数据增加处理页面
     */
    public function EJDH_Insert_Action()
    {
        $ejdh_bh_ora = security_decrypt($_POST["EJDH_BH_ORA"]);
        if ($ejdh_bh_ora == null) {
            $this->ajaxReturn(array("success" => false, "message" => "您传入的参数非法！"));
            return;
        }
        $result = ""; //数据插入的结果
        $ejdh = new EJDH($_POST);
        $ejdh_insert = new EJDH();
        $ejdh_insert->EJDH_BH = $ejdh_bh_ora;

        //如果需要限制用户插入的信息，可选择性修改下方内容
        $ejdh_insert->YJDH_BH = $ejdh->YJDH_BH; //一级导航_编号
        $ejdh_insert->EJDH_MC = $ejdh->EJDH_MC; //二级导航_名称
        $ejdh_insert->EJDH_TZFS = $ejdh->EJDH_TZFS; //二级导航_跳转方式
        $ejdh_insert->EJDH_CLJ = $ejdh->EJDH_CLJ; //二级导航_超链接
        $ejdh_insert->EJDH_XSSX = $ejdh->EJDH_XSSX; //二级导航_显示顺序
        $result .= $ejdh_insert->insert();
        $this->ajaxReturn(array("success" => empty($result), "message" => $result));
    }
    #endregion 数据添加页面

    #region 删除数据处理
    /**
     * 根据主键删除单一对象
     */
    public function EJDH_Delete()
    {
        //参数检查
        $ejdh_bh=$_GET['EJDH_BH'];
        if (!empty($ejdh_bh)) {
            $ejdh_bh = security_decrypt($ejdh_bh);
            if ($ejdh_bh == null) {
                $this->ajaxReturn(array("success" => false, "message" => "您传入的参数非法！"));
                return;
            }
        }

        //删除数据
        $ejdh = new EJDH();
        $result = $ejdh->delete($ejdh_bh);
        $this->ajaxReturn(array("success" => empty($result), "message" => $result));
    }
    #endregion 删除数据处理

    #region 数据修改页面
    /**
     * 数据修改首页面
     */
    public function EJDH_Update()
    {
        //传入参数检查
        $ejdh_bh=$_GET['EJDH_BH'];
        if (!empty($ejdh_bh)) {
            $ejdh_bh = security_decrypt($ejdh_bh);
            if ($ejdh_bh == null) {
                $this->ajaxReturn(array("success" => false, "message" => "您传入的参数非法！"));
                return;
            }
        }

        //数据验证
        $ejdh = new EJDH();
        $result = $ejdh->fetch($ejdh_bh);
        if (!empty($result)) {
            $this->ajaxReturn(array("success" => false, "message" => "您要修改的数据已被他人删除！"));
            return;
        }

        //进入数据修改页面
        $this->assign("Model",$ejdh );
        $this->display('EJDH_Update');
    }

    /**
     * 数据修改处理页面
     */
    public function EJDH_Update_Action()
    {
        //数据验证
        $ejdh_bh_ora = security_decrypt($_POST["EJDH_BH_ORA"]);
        if ($ejdh_bh_ora == null) {
            $this->ajaxReturn(array("success" => false, "message" => "您传入的参数非法！"));
            return;
        }

        $ejdh = new EJDH($_POST);

        //检查数据是否存在
        $ejdh_update = new EJDH();
        $result = $ejdh_update->fetch($ejdh_bh_ora);
        if (!empty($result)) {
            $this->ajaxReturn(array("success" => false, "message" => "您要修改的数据已被他人删除！"));
            return;
        }

        //如果需要限制用户插入的信息，可选择性修改下方内容
        $ejdh_update->YJDH_BH = $ejdh->YJDH_BH; //一级导航_编号
        $ejdh_update->EJDH_MC = $ejdh->EJDH_MC; //二级导航_名称
        $ejdh_update->EJDH_TZFS = $ejdh->EJDH_TZFS; //二级导航_跳转方式
        $ejdh_update->EJDH_CLJ = $ejdh->EJDH_CLJ; //二级导航_超链接
        $ejdh_update->EJDH_XSSX = $ejdh->EJDH_XSSX; //二级导航_显示顺序
        $result .= $ejdh_update->update($ejdh_bh_ora);
        $this->ajaxReturn(array("success" => empty($result), "message" => $result));
    }
    #endregion 数据修改页面

    #region 数据查询
    /**
     * 默认进入的数据查询页面
     */
    public function EJDH_Query()
    {
        #region 初始化页面参数
        $pageSize =array_key_exists("PageSize",$_POST) ? $_POST["PageSize"] : 20; //分页大小
        $pageIndex = array_key_exists("PageIndex",$_POST) ? $_POST["PageIndex"] : 1; //当前页
        $orderby=""; //默认排序方式可以留空，如需修改需要参照　"order by YHXX.YHXX_BH "格式
        $sql= ""; //如无特殊要求，不要扩展该属性

        $params =  array();
        $params['MHCX'] = $_POST['MHCX'];
        $params['YJDH_BH'] = $_POST['YJDH_BH'];
        $params['EJDH_TZFS'] = $_POST['EJDH_TZFS'];
        #endregion 初始化页面参数

        //保存相关参数
        $this->assign("params", $params);
        $this->assign("Model", EJDH::query($params, $pageSize,$pageIndex,$orderby,$sql));
        //显示view
        $this->display('EJDH_Query');
    }
    #endregion 数据查询

    #endregion 二级导航管理功能

    #region 三级导航管理功能

    #region 管理首页
    /**
     * 默认进入的管理列表页面
     */
    public function SJDH_Index()
    {

        #region 初始化页面参数
        $pageSize =array_key_exists("PageSize",$_GET) ? $_GET["PageSize"] : 20; //分页大小
        $pageIndex = array_key_exists("PageIndex",$_GET) ? $_GET["PageIndex"] : 1; //当前页
        $orderby=""; //默认排序方式可以留空，如需修改需要参照　"order by YHXX.YHXX_BH "格式
        $sql= ""; //如无特殊要求，不要扩展该属性

        $params =  array();
        $params['MHCX'] = $_GET['MHCX'];
        $params['EJDH_BH'] = $_GET['EJDH_BH'];
        $params['SJDH_TZFS'] = $_GET['SJDH_TZFS'];
        #endregion 初始化页面参数

        //处理加密后的外键
        if (!empty($params["EJDH_BH"])) {
            $params["EJDH_BH"] = security_decrypt($params["EJDH_BH"]);
            if ($params["EJDH_BH"] == null) {
                $this->ajaxReturn(array("success" => false, "message" => "您传入的参数非法！"));
                return;
            }
        }

        //保存相关参数
        $this->assign("params", $params);
        $this->assign("Model", SJDH::query($params, $pageSize,$pageIndex,$orderby,$sql));
        //显示view
        $this->display('SJDH_Index');
    }
    #endregion 管理首页

    #region 数据添加页面
    /**
     * 数据增加初始页面
     */
    public function SJDH_Insert()
    {
        $sjdh = new SJDH($_POST);
        $this->assign("Model", $sjdh);
        $this->display('SJDH_Insert');
    }

    /**
     * 数据增加处理页面
     */
    public function SJDH_Insert_Action()
    {
        $sjdh_bh_ora = security_decrypt($_POST["SJDH_BH_ORA"]);
        if ($sjdh_bh_ora == null) {
            $this->ajaxReturn(array("success" => false, "message" => "您传入的参数非法！"));
            return;
        }
        $result = ""; //数据插入的结果
        $sjdh = new SJDH($_POST);
        $sjdh_insert = new SJDH();
        $sjdh_insert->SJDH_BH = $sjdh_bh_ora;

        //如果需要限制用户插入的信息，可选择性修改下方内容
        $sjdh_insert->EJDH_BH = $sjdh->EJDH_BH; //二级导航_编号
        $sjdh_insert->SJDH_MC = $sjdh->SJDH_MC; //三级导航_名称
        $sjdh_insert->SJDH_TZFS = $sjdh->SJDH_TZFS; //三级导航_跳转方式
        $sjdh_insert->SJDH_CLJ = $sjdh->SJDH_CLJ; //三级导航_超链接
        $sjdh_insert->SJDH_XSSX = $sjdh->SJDH_XSSX; //三级导航_显示顺序
        $result .= $sjdh_insert->insert();
        $this->ajaxReturn(array("success" => empty($result), "message" => $result));
    }
    #endregion 数据添加页面

    #region 删除数据处理
    /**
     * 根据主键删除单一对象
     */
    public function SJDH_Delete()
    {
        //参数检查
        $sjdh_bh=$_GET['SJDH_BH'];
        if (!empty($sjdh_bh)) {
            $sjdh_bh = security_decrypt($sjdh_bh);
            if ($sjdh_bh == null) {
                $this->ajaxReturn(array("success" => false, "message" => "您传入的参数非法！"));
                return;
            }
        }

        //删除数据
        $sjdh = new SJDH();
        $result = $sjdh->delete($sjdh_bh);
        $this->ajaxReturn(array("success" => empty($result), "message" => $result));
    }
    #endregion 删除数据处理

    #region 数据修改页面
    /**
     * 数据修改首页面
     */
    public function SJDH_Update()
    {
        //传入参数检查
        $sjdh_bh=$_GET['SJDH_BH'];
        if (!empty($sjdh_bh)) {
            $sjdh_bh = security_decrypt($sjdh_bh);
            if ($sjdh_bh == null) {
                $this->ajaxReturn(array("success" => false, "message" => "您传入的参数非法！"));
                return;
            }
        }

        //数据验证
        $sjdh = new SJDH();
        $result = $sjdh->fetch($sjdh_bh);
        if (!empty($result)) {
            $this->ajaxReturn(array("success" => false, "message" => "您要修改的数据已被他人删除！"));
            return;
        }

        //进入数据修改页面
        $this->assign("Model",$sjdh );
        $this->display('SJDH_Update');
    }

    /**
     * 数据修改处理页面
     */
    public function SJDH_Update_Action()
    {
        //数据验证
        $sjdh_bh_ora = security_decrypt($_POST["SJDH_BH_ORA"]);
        if ($sjdh_bh_ora == null) {
            $this->ajaxReturn(array("success" => false, "message" => "您传入的参数非法！"));
            return;
        }

        $sjdh = new SJDH($_POST);

        //检查数据是否存在
        $sjdh_update = new SJDH();
        $result = $sjdh_update->fetch($sjdh_bh_ora);
        if (!empty($result)) {
            $this->ajaxReturn(array("success" => false, "message" => "您要修改的数据已被他人删除！"));
            return;
        }

        //如果需要限制用户插入的信息，可选择性修改下方内容
        $sjdh_update->EJDH_BH = $sjdh->EJDH_BH; //二级导航_编号
        $sjdh_update->SJDH_MC = $sjdh->SJDH_MC; //三级导航_名称
        $sjdh_update->SJDH_TZFS = $sjdh->SJDH_TZFS; //三级导航_跳转方式
        $sjdh_update->SJDH_CLJ = $sjdh->SJDH_CLJ; //三级导航_超链接
        $sjdh_update->SJDH_XSSX = $sjdh->SJDH_XSSX; //三级导航_显示顺序
        $result .= $sjdh_update->update($sjdh_bh_ora);
        $this->ajaxReturn(array("success" => empty($result), "message" => $result));
    }
    #endregion 数据修改页面

    #region 数据查询
    /**
     * 默认进入的数据查询页面
     */
    public function SJDH_Query()
    {
        #region 初始化页面参数
        $pageSize =array_key_exists("PageSize",$_POST) ? $_POST["PageSize"] : 20; //分页大小
        $pageIndex = array_key_exists("PageIndex",$_POST) ? $_POST["PageIndex"] : 1; //当前页
        $orderby=""; //默认排序方式可以留空，如需修改需要参照　"order by YHXX.YHXX_BH "格式
        $sql= ""; //如无特殊要求，不要扩展该属性

        $params =  array();
        $params['MHCX'] = $_POST['MHCX'];
        $params['EJDH_BH'] = $_POST['EJDH_BH'];
        $params['SJDH_TZFS'] = $_POST['SJDH_TZFS'];
        #endregion 初始化页面参数

        //保存相关参数
        $this->assign("params", $params);
        $this->assign("Model", SJDH::query($params, $pageSize,$pageIndex,$orderby,$sql));
        //显示view
        $this->display('SJDH_Query');
    }
    #endregion 数据查询

    #endregion 三级导航管理功能

}